package com.school.campus.service.impl;

import java.util.List;

import com.school.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.school.campus.mapper.CampusNoticeMapper;
import com.school.campus.domain.CampusNotice;
import com.school.campus.service.ICampusNoticeService;

/**
 * 学校资讯Service业务层处理
 *
 * @author wwj
 * @date 2025-10-30
 */
@Service
public class CampusNoticeServiceImpl implements ICampusNoticeService {
    @Autowired
    private CampusNoticeMapper campusNoticeMapper;

    /**
     * 查询学校资讯
     *
     * @param id 学校资讯主键
     * @return 学校资讯
     */
    @Override
    public CampusNotice selectCampusNoticeById(Long id) {
        return campusNoticeMapper.selectCampusNoticeById(id);
    }

    /**
     * 查询学校资讯列表
     *
     * @param campusNotice 学校资讯
     * @return 学校资讯
     */
    @Override
    public List<CampusNotice> selectCampusNoticeList(CampusNotice campusNotice) {
        return campusNoticeMapper.selectCampusNoticeList(campusNotice);
    }

    /**
     * 新增学校资讯
     *
     * @param campusNotice 学校资讯
     * @return 结果
     */
    @Override
    public int insertCampusNotice(CampusNotice campusNotice) {

        campusNotice.setNotifyTime(DateUtils.getNowDate());
        return campusNoticeMapper.insertCampusNotice(campusNotice);
    }

    /**
     * 修改学校资讯
     *
     * @param campusNotice 学校资讯
     * @return 结果
     */
    @Override
    public int updateCampusNotice(CampusNotice campusNotice) {
        return campusNoticeMapper.updateCampusNotice(campusNotice);
    }

    /**
     * 批量删除学校资讯
     *
     * @param ids 需要删除的学校资讯主键
     * @return 结果
     */
    @Override
    public int deleteCampusNoticeByIds(Long[] ids) {
        return campusNoticeMapper.deleteCampusNoticeByIds(ids);
    }

    /**
     * 删除学校资讯信息
     *
     * @param id 学校资讯主键
     * @return 结果
     */
    @Override
    public int deleteCampusNoticeById(Long id) {
        return campusNoticeMapper.deleteCampusNoticeById(id);
    }
}
